float4x4 World;
float4x4 View;
float4x4 Projection;

// TODO: add effect parameters here.

float4 ColorOn = (1,1,1,1);
float4 ColorOff = (1,1,1,0);
bool IsOn = false;
float LightPower = 1.0f;

bool PixelOn = true;

float AlphaValue = 1.0f;

struct VertexShaderInput
{
    float4 Position : POSITION0;

    // TODO: add input channels such as texture
    // coordinates and vertex colors here.
};

struct VertexShaderOutput
{
    float4 Position : POSITION0;

    // TODO: add vertex shader outputs such as colors and texture
    // coordinates here. These values will automatically be interpolated
    // over the triangle, and provided as input to your pixel shader.
};

VertexShaderOutput VertexShaderFunction(VertexShaderInput input)
{
    VertexShaderOutput output;

    float4 worldPosition = mul(input.Position, World);
    float4 viewPosition = mul(worldPosition, View);
    output.Position = mul(viewPosition, Projection);

    return output;
}

float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
{
    // TODO: add your pixel shader code here.

	if(IsOn)
	{
		if(PixelOn)
		{			
			float Diffuse = saturate(LightPower);
		
			float4 color = mul(Diffuse,ColorOn);
		
			color.a = AlphaValue;
			
			return color;
		}
		else
		{
			discard;
		}
		
	}
	else
	{
		if(PixelOn)
		{			
			ColorOff.a = AlphaValue;
			return ColorOff;										
		}
		else
		{
			discard;
		}
	}
}

technique LightBulb
{
    pass Pass1
    {
        // TODO: set renderstates here.
        
        // Alpha blending
        AlphaBlendEnable = true;
        SrcBlend = SrcAlpha;
        DestBlend = InvSrcAlpha;

        VertexShader = compile vs_2_0 VertexShaderFunction();
        PixelShader = compile ps_2_0 PixelShaderFunction();
    }
}
